import { Injectable, InjectByName, InjectFactory } from '../../decorators/inject';
import { TAllTypes, IAllPosition } from '../../utils/formula/types';
import { isPositionValue } from '../../utils/formula/utils';
import { ITableDatas } from '../table-datas.interface';
import { isContainRange } from '../../utils/tools';
import { NTableEvent } from '../../types/cors';
import { Subject } from 'rxjs';

export function detectedLoop(tableDatas: ITableDatas, self: TRange) {
  const func = (target: any) => {

  }
  return func;
}
@Injectable()
export class Dependence {
  protected dependences: IAllPosition[] = [];
  public dependentChange: Subject<void> = new Subject();
  constructor(
    @InjectByName('TableDatas') protected tableDatas: ITableDatas,
    @InjectByName('TableEvent') protected tableEvent: NTableEvent.IDataEvent,
  ) {

  }
  protected observeDependChange() {

  }
  public getDependces() {
    return this.dependences;
  }
  public update(dependences: TAllTypes[]) {
    this.dependences = dependences.filter(item => isPositionValue(item)) as IAllPosition[];
    
  }
  public distory() {
    this.dependentChange.complete();
  }
}